package com.weather;

import io.smallrye.mutiny.Uni;
import io.smallrye.mutiny.infrastructure.Infrastructure;
import org.jboss.resteasy.annotations.jaxrs.PathParam;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Produces(MediaType.TEXT_PLAIN)
@ApplicationScoped
@Path("/weather")
public class GreetingResource {

    @Inject
    WeatherService weatherService;


    @GET
    @Path("{city}")
    public Uni<String> weatherOfCity(@PathParam("city") String city) throws Exception {
        //return weatherService.getCityWeather(city);
        return Uni.createFrom().item(weatherService.getCityWeather(city));
    }


}
